<div class="content-section introduction">
    <div>
        <span class="feature-title">Slide Menu</span>
        <span>SlideMenu displays submenus with slide animation.</span>
    </div>
</div>

<div class="content-section implementation">
    <h3 class="first">Default</h3>
    <p-slideMenu [model]="items"></p-slideMenu>

    <h3>Popup</h3>
    <p-slideMenu #menu [model]="items" [popup]="true"></p-slideMenu>
    <button #btn type="button" pButton icon="fa fa-list" label="Show" (click)="menu.toggle($event)"></button>
</div>

<div class="content-section documentation">
    <p-tabView effect="fade">
        <p-tabPanel header="Documentation">
            <h3>Import</h3>
<pre>
<code class="language-typescript" pCode ngNonBindable>
import &#123;SlideMenuModule,MenuItem&#125; from 'primeng/primeng';
</code>
</pre>

            <h3>MenuModel API</h3>
            <p>SlideMenu uses the common menumodel api to define its items, visit <a [routerLink]="['/menumodel']">MenuModel API</a> for details.</p>

            <h3>Getting Started</h3>
            <p>SlideMenu requires nested menuitems as its model.</p>
<pre>
<code class="language-markup" pCode ngNonBindable>
&lt;p-slideMenu [model]="items"&gt;&lt;/p-slideMenu&gt;
</code>
</pre>

<pre>
<code class="language-typescript" pCode ngNonBindable>
export class SlideMenuDemo &#123;

    items: MenuItem[];

    ngOnInit() &#123;
        this.items = [
            &#123;
                label: 'File',
                items: [&#123;
                        label: 'New', 
                        icon: 'fa-plus',
                        items: [
                            &#123;label: 'Project'&#125;,
                            &#123;label: 'Other'&#125;,
                        ]
                    &#125;,
                    &#123;label: 'Open'&#125;,
                    &#123;label: 'Quit'&#125;
                ]
            &#125;,
            &#123;
                label: 'Edit',
                icon: 'fa-edit',
                items: [
                    &#123;label: 'Undo', icon: 'fa-mail-forward'&#125;,
                    &#123;label: 'Redo', icon: 'fa-mail-reply'&#125;
                ]
            &#125;
        ];
    &#125;
&#125;
</code>
</pre>

            <h3>Popup Mode</h3>
            <p>SlideMenu is inline by default, popup mode is also supported by enabling popup property and calling toggle method by passing the event 
                    from the anchor element.</p>
<pre>
<code class="language-markup" pCode ngNonBindable>
&lt;p-slideMenu #menu [model]="items" [popup]="true"&gt;&lt;/p-slideMenu&gt;
&lt;button #btn type="button" pButton icon="fa fa-list" label="Show" (click)="menu.toggle($event)"&gt;&lt;/button&gt;
</code>
</pre>

            <h3>Effects</h3>
            <p>The easing function to use is "ease-out" by default and this can be customized using easing property. 
                See <a href="http://www.w3schools.com/cssref/css3_pr_transition-timing-function.asp">here</a> for possible alternative values.</p>
<pre>
<code class="language-markup" pCode ngNonBindable>
&lt;p-slideMenu #menu [model]="items" effectDuration="1000" easing="ease-in"&gt;&lt;/p-slideMenu&gt;
</code>
</pre>


            <h3>Properties</h3>
            <div class="doc-tablewrapper">
                <table class="doc-table">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Type</th>
                            <th>Default</th>
                            <th>Description</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>model</td>
                            <td>array</td>
                            <td>null</td>
                            <td>An array of menuitems.</td>
                        </tr>
                        <tr>
                            <td>popup</td>
                            <td>boolean</td>
                            <td>false</td>
                            <td>Defines if menu would displayed as a popup.</td>
                        </tr>
                        <tr>
                            <td>style</td>
                            <td>string</td>
                            <td>null</td>
                            <td>Inline style of the component.</td>
                        </tr>
                        <tr>
                            <td>styleClass</td>
                            <td>string</td>
                            <td>null</td>
                            <td>Style class of the component.</td>
                        </tr>
                        <tr>
                            <td>easing</td>
                            <td>string</td>
                            <td>ease-out</td>
                            <td>Easing animation to use for sliding.</td>
                        </tr>
                        <tr>
                            <td>effectDuration</td>
                            <td>any</td>
                            <td>250</td>
                            <td>Duration of the sliding animation in milliseconds.</td>
                        </tr>
                        <tr>
                           <td>backLabel</td>
                           <td>string</td>
                           <td>Back</td>
                           <td>Label of element to navigate back.</td>
                       </tr>
                       <tr>
                          <td>menuWidth</td>
                          <td>number</td>
                          <td>180</td>
                          <td>Width of the submenus.</td>
                      </tr>
                      <tr>
                         <td>viewportHeight</td>
                         <td>number</td>
                         <td>175</td>
                         <td>Height of the scrollable area, a scrollbar appears if a menu height is longer than this value.</td>
                     </tr>
                    </tbody>
                </table>
            </div>
            
            <h3>Methods</h3>
            <div class="doc-tablewrapper">
                <table class="doc-table">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Parameters</th>
                            <th>Description</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>toggle</td>
                            <td>event: browser event</td>
                            <td>Toggles the visibility of the popup menu.</td>
                        </tr>
                        <tr>
                            <td>show</td>
                            <td>event: browser event</td>
                            <td>Displays the popup menu.</td>
                        </tr>
                        <tr>
                            <td>hide</td>
                            <td>-</td>
                            <td>Hides the popup menu.</td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <h3>Styling</h3>
            <p>Following is the list of structural style classes, for theming classes visit <a href="#" [routerLink]="['/theming']">theming page</a>.</p>
            <div class="doc-tablewrapper">
                <table class="doc-table">
                    <thead>
                    <tr>
                        <th>Name</th>
                        <th>Element</th>
                    </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>ui-slidemenu</td>
                            <td>Container element.</td>
                        </tr>
                        <tr>
                            <td>ui-slidemenu-wrapper</td>
                            <td>Wrapper of content.</td>
                        </tr>
                        <tr>
                            <td>ui-slidemenu-content</td>
                            <td>Content element.</td>
                        </tr>
                        <tr>
                            <td>ui-slidemenu-backward</td>
                            <td>Element to navigate to previous menu on click.</td>
                        </tr>
                        <tr>
                            <td>ui-menu-list</td>
                            <td>List element.</td>
                        </tr>
                        <tr>
                            <td>ui-menuitem</td>
                            <td>Menuitem element.</td>
                        </tr>
                        <tr>
                            <td>ui-menuitem-text</td>
                            <td>Label of a menuitem.</td>
                        </tr>
                        <tr>
                            <td>ui-menuitem-icon</td>
                            <td>Icon of a menuitem.</td>
                        </tr>
                        <tr>
                            <td>ui-submenu-icon</td>
                            <td>Arrow icon of a submenu.</td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <h3>Dependencies</h3>
            <p>None.</p>
        </p-tabPanel>

        <p-tabPanel header="Source">
            <a href="https://github.com/primefaces/primeng/tree/master/src/app/showcase/components/slidemenu" class="btn-viewsource" target="_blank">
                <i class="fa fa-github"></i>
                <span>View on GitHub</span>
            </a>
<pre>
<code class="language-markup" pCode ngNonBindable>
&lt;h3 class="first"&gt;Default&lt;/h3&gt;
&lt;p-slideMenu [model]="items"&gt;&lt;/p-slideMenu&gt;

&lt;h3&gt;Popup&lt;/h3&gt;
&lt;p-slideMenu #menu [model]="items" [popup]="true"&gt;&lt;/p-slideMenu&gt;
&lt;button #btn type="button" pButton icon="fa fa-list" label="Show" (click)="menu.toggle($event)"&gt;&lt;/button&gt;
</code>
</pre>

<pre>
<code class="language-typescript" pCode ngNonBindable>
export class SlideMenuDemo &#123;

    items: MenuItem[];

    ngOnInit() &#123;
        this.items = [
            &#123;
                label: 'File',
                icon: 'fa-file-o',
                items: [&#123;
                        label: 'New', 
                        icon: 'fa-plus',
                        items: [
                            &#123;label: 'Project'&#125;,
                            &#123;label: 'Other'&#125;,
                        ]
                    &#125;,
                    &#123;label: 'Open'&#125;,
                    &#123;separator:true&#125;,
                    &#123;label: 'Quit'&#125;
                ]
            &#125;,
            &#123;
                label: 'Edit',
                icon: 'fa-edit',
                items: [
                    &#123;label: 'Undo', icon: 'fa-mail-forward'&#125;,
                    &#123;label: 'Redo', icon: 'fa-mail-reply'&#125;
                ]
            &#125;,
            &#123;
                label: 'Help',
                icon: 'fa-question',
                items: [
                    &#123;
                        label: 'Contents'
                    &#125;,
                    &#123;
                        label: 'Search', 
                        icon: 'fa-search', 
                        items: [
                            &#123;
                                label: 'Text', 
                                items: [
                                    &#123;
                                        label: 'Workspace'
                                    &#125;
                                ]
                            &#125;,
                            &#123;
                                label: 'File'
                            &#125;
                    ]&#125;
                ]
            &#125;,
            &#123;
                label: 'Actions',
                icon: 'fa-gear',
                items: [
                    &#123;
                        label: 'Edit',
                        icon: 'fa-refresh',
                        items: [
                            &#123;label: 'Save', icon: 'fa-save'&#125;,
                            &#123;label: 'Update', icon: 'fa-save'&#125;,
                        ]
                    &#125;,
                    &#123;
                        label: 'Other',
                        icon: 'fa-phone',
                        items: [
                            &#123;label: 'Delete', icon: 'fa-minus'&#125;
                        ]
                    &#125;
                ]
            &#125;,
            &#123;separator:true&#125;,
            &#123;
                label: 'Quit', icon: 'fa-minus'
            &#125;
        ];
    &#125;
&#125;
</code>
</pre>
        </p-tabPanel>
    </p-tabView>
</div>